package com.foreknow.demo5;

/**
 * 构造器(构造函数/构造方法)
 * 构造器如何初始化变量
 */
public class ConstrctopDemo {
        private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ConstrctopDemo(String name){
        this.name = name;
//        System.out.println("构造器的作用是初始化的......");
    }

    public static void main(String[] args) {
        ConstrctopDemo c = new ConstrctopDemo("tom");
    }
}
